import java.util.Scanner;

public class NestedConstructs {
    public static void middleNumber(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt(), n2 = sc.nextInt(), n3 = sc.nextInt();
        System.out.println(Math.min(Math.min(Math.max(n1, n2), Math.max(n1, n3)), Math.min(Math.max(n2, n1), Math.max(n2, n3))));
    }

    public static void middleNumberAlter(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
        if ((a >= b & a <= c) || (a <= b & a >= c)) {
            System.out.print(a);
        } else if ((b >= a & b <= c) || (b <= a & b >= c)) {
            System.out.print(b);
        } else {
            System.out.print(c);
        }

    }

    public static void middleNumberHighLevel(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
        System.out.print(((a <= b && a >= c) || (a >= b && a <= c)) ? a : (((b <= a && b >= c) || (b >= a && b <= c)) ? b : c));

    }
    public static void middleNumberVHL(String[] args) {
        Scanner sc =new Scanner(System.in);
        int a=sc.nextInt(), b=sc.nextInt(), c=sc.nextInt(), x;

        if(a>b){x=a;a=b;b=x;}
        if(b>c){x=b;b=c;c=x;}
        if(a>b){x=a;a=b;b=x;}

        System.out.print(b);


    }
    public static void salaryOfDev(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt(), b=sc.nextInt(), c=sc.nextInt();
        int difference = sc.nextInt();
        System.out.print(Math.abs(a - b) + Math.abs(b - c) > difference * 2
                ? "Ура, бастуем!": "За работу, Солнце ещё высоко");


    }
    public static void salaryOfDevAlter(String...i) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
        System.out.print(
                Math.max(Math.max(a,b),c) - Math.min(Math.min(a,b),c) > sc.nextInt()
                        ? "Ура, бастуем!" : "За работу, Солнце ещё высоко");
    }
    public static void coordinates(String...i) {
        Scanner sc = new Scanner(System.in);
        int a1 = sc.nextInt(), b1 = sc.nextInt();
        int a2 = sc.nextInt(), b2 = sc.nextInt();
        System.out.printf(b1 > a2 && a1 < b2  ? "" + Math.max(a1,a2) + " " + Math.min(b1,b2):
                a1 == b2  ? "" + a1 : b1 == a2 ? ""+ b1: "Пересечения нет");

    }

    public static void maxEvenNumbers(String...i) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), x = -1;
        if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0 ) {
            if (a%2==0) {x=a;}
            if (b%2==0 && b>x) {x=b;}
            if (c%2==0 && c>x ) {x=c;}
        }
        System.out.printf(x != -1 ? "" + x:"Чётных чисел нет");
    }

}